package com.vinci.wishDemo.service.impl;

import com.vinci.wishDemo.entity.TbContentTopic;
import com.vinci.wishDemo.entity.TbContentWishList;
import com.vinci.wishDemo.mapper.TbContentWishListMapper;
import com.vinci.wishDemo.service.TbContentWishListService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 心愿单表 服务实现类
 * </p>
 *
 * @author 郭三木
 * @since 2021-12-10
 */
@Service
public class TbContentWishListServiceImpl extends ServiceImpl<TbContentWishListMapper, TbContentWishList> implements TbContentWishListService {
    @Resource
    private TbContentWishListMapper wishListMapper;
    @Autowired
    private RedisTemplate redisTemplate;

    @Override
    public IPage<TbContentWishList> selectPageVo(Page<TbContentWishList> page) {
        IPage<TbContentWishList> tbContentWishListIPage = null;
        try {
            tbContentWishListIPage = wishListMapper.selectPageVo(page);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return tbContentWishListIPage;
    }

    /*
    查询心愿列表
     */
    @Override
    public List<TbContentWishList> querylist(String createBy, String beginTime, String endTime) {
        List<TbContentWishList> querylist = null;
        try {
                querylist = wishListMapper.querylist(createBy, beginTime, endTime);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return querylist;
    }

    /*
    回复心愿
     */
    @Override
    public void replyWish(String userId, String format, String wishId, String replyContent, Integer wishStats) {
        try {
            wishListMapper.replyWish(userId, format, wishId, replyContent, wishStats);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /*
    删除心愿
     */
    @Override
    public void delwish(String wishId) {
        try {
            wishListMapper.delwish(wishId);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /*
    查看心愿状态
     */
    @Override
    public TbContentWishList querystats(String wishId) {
        TbContentWishList wishstats = null;
        try {
            wishstats= wishListMapper.querystats(wishId);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return wishstats;
    }
}
